home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in</name>
- <id>-1</id>
- <cardCount>20</cardCount>
- <cardID>2944</cardID>
- <listID>2093</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>342</height>
- </cardSize>
- <script>on idle
- set lockscreen to false
- end idle
- function getLine fileName
- -- read one line from the file
- read from file fileName until return
- put it into msg
- return (it)
- end getLine
- function terminator thisLine
- -- is thisLine a message terminator?
- global terminators
- if char 1 to 5 of thisLine is "Topic" and char 10 of thisLine is ":" ¬
- then return true
- repeat with i = 1 to number of lines in terminators
- if line i of terminators is in thisLine then return true
- end repeat
- return false
- end terminator
- function getNum thisLine
- -- crack the leading number from a contents line
- put offset(":", thisLine) into endHere
- return value(char 1 to endHere - 1 of thisLine)
- end getNum
- function insertLine theField,thisNum,thisLine
- -- figure out where the new line should go in contents
- -- blank contents?
- if bkgnd field theField is empty then
- put thisLine into bkgnd field theField
- return 1
- end if
- -- at end? (the most common case - checked first)
- if getNum(last line of bkgnd field theField) < thisNum then
- put thisLine after bkgnd field theField
- return number of lines in bkgnd field theField
- end if
- -- all right, do it the hard way
- repeat with i = 1 to number of lines in bkgnd field theField
- if thisNum < getNum(line i of bkgnd field theField) then
- put thisLine before line i of bkgnd field theField
- return i
- end if
- end repeat
- end insertLine
- on addText newText
- -- concatenate to global text object, observing size limit
- global theText, textLength
- add length(newText) to textLength
- if textLength > 29990 then exit addText
- put newText after theText
- end addText
- function slurpText fileName,discard,putHere
- -- skip null lines, build message, paste into card
- -- return terminating line for analysis
- global theText, textLength
- repeat discard
- put getline(fileName) into foo
- end repeat
- put empty into theText
- put 0 into textLength
- repeat
- -- pull in the message text
- -- done offscreen for performance reasons (no redraws)
- put getLine(fileName) into theLine
- if terminator(theLine) then exit repeat
- addText theLine
- end repeat
- put theText into bkgnd field putHere
- return theLine
- end slurpText
- on setID topicID,idLine
- -- put id of this card into hidden link field of topic header card
- if idLine is 0 then exit setID
- get the id of this card
- put it into line idLine of field "theLinks" of card id (word 3 of topicID)
- end setID
- on import
- -- don't try to understand the details without a WELL transcript!
- global terminators
- ask "Please enter name of text file:"
- if it is empty then exit import
- put it into fileName
- open file fileName
- put "Interrupt!" & return & "(r)espond" & return & "responses total."¬
- into terminators
- repeat
- put getLine(fileName) into theLine
- if theLine is empty then exit repeat
- repeat while char 1 to 5 of theLine is "Topic" ¬
- and char 10 of theLine is ":"
- delete last char of theLine
- delete char 11 of theLine
- delete char 1 to 5 of theLine
- put getNum(theLine) into topicNum
- put topicNum into char 1 to 4 of theLine
- if theLine is not in field "theTopics" of card "Conference" then
- -- There is no Topic line in the Conference card
- go to card "Conference"
- put char 1 to 65 of theLine & return into theLine
- put insertLine("theTopics", topicNum, theLine) into foo
- end if
- put theLine into topicLine
- go to card ("Topic" & topicNum) of bkgnd "Topic"
- if the result is not empty then
- -- There is no Topic header card for this topic
- go to card 1 of bkgnd "Topic"
- doMenu Copy Card
- go to last card
- doMenu Paste Card
- set the name of this card to "Topic" & topicNum
- put theLine into bkgnd field "theTopic"
- -- read author line
- put getLine(fileName) into theLine
- if char 1 to 4 of theLine is "By: " then
- -- This is originator's message
- delete char 1 to 4 of theLine
- put offset("